﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAchive.Model.DataShow
{
    public class DataShowViewModel:INotifyPropertyChanged
    {
        private decimal directRate;
        /// <summary>
        /// 5% 直通率
        /// </summary>
        public decimal DirectRate 
        {
            get { return directRate; }
            set
            {
             directRate = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DirectRate)));
            }
        
        }

        private int overJudge;
        //过判数量
        public int OverJudge {
            get { return overJudge; }
            set{
                overJudge = value;
                PropertyChanged?.Invoke(this,new PropertyChangedEventArgs(nameof(OverJudge)));
            }
        }

        private string machineInfo;
        //机台
        public string MachineInfo
        {
            get { return machineInfo; }
            set
            {
                machineInfo = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MachineInfo)));
            }
        }

        private int productNumber;
        //生产总数
        public int ProductNumber
        {
            get { return productNumber; }
            set
            {
                productNumber = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ProductNumber)));
            }
        }

        public ObservableCollection<EveryOneDefectRate> EveryOneDefectRates { get; set; }

        public event PropertyChangedEventHandler PropertyChanged;
    }

    public class EveryOneDefectRate:INotifyPropertyChanged
    {
        private string defectName;
        //缺陷名称
        public string DefectName 
        {
            get { return defectName; }
            set
            {
                defectName = value;
                PropertyChanged?.Invoke(this,new PropertyChangedEventArgs(nameof(DefectName)));
            }
        }

        private int defectNumber;
        //缺陷数量
        public int DefectNumber {
            get { return defectNumber; }
            set
            {
                defectNumber = value;
                PropertyChanged?.Invoke(this,new PropertyChangedEventArgs(nameof(DefectName)));
            }
        }

        private decimal defectRate;
        public decimal DefectRate {
            get { return defectRate; }
            set
            {
                defectRate = value;
                PropertyChanged?.Invoke(this,new PropertyChangedEventArgs(nameof(DefectRate)));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }


    public class ErrorConnectViewModel : INotifyPropertyChanged
    {
        private string errorConnectStr;

        public string ErrorConnectStr
        {
            get { return errorConnectStr; }

            set
            {
                errorConnectStr = value;
                PropertyChanged?.Invoke(this,new PropertyChangedEventArgs(ErrorConnectStr));
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
    }
}
